<?xml version="1.0" encoding="utf-8" ?>

[#include "/WEB-INF/pages/common/taglibs.ftl"]
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Model</title>
	<meta name="menu" content="CategoryMenu"/> 
	<meta name="heading" content="heading"/>
	
	[#assign renderTo="#formArticle"]
	<script type="text/javascript" src="[@c.url value='/js/custom/tables.js'/]"></script>
	<script type="text/javascript" src="[@c.url value='/js/plugins/jquery.alerts.js'/]"></script>
	<script type="text/javascript">
		var base = (function(){
			// 事件绑定
			function _addEventListeners() {
				$('a[act=edit]').click(function(){
					var id = $(this).parent().attr('tval');
					[@c.url var="editUrl" value='/manage/FormArticle_edit.action' scope="page"]
						[@c.param name="id" value=""/]
					[/@c.url]
					
					window.location = "${editUrl}" + id;
				})
			
				$('a[act=delete]').click(function(){
					var id = $(this).parent().attr('tval');
					var id = $(this).parent().attr('tval');
					var title = $('#delete-confirm').attr('title');
					var content = $('#delete-confirm').html();
					jConfirm(content, title, function(r) {
						if (r) {
							[@c.url	var="deleteUrl" value='/manage/FormArticle_delete.action' scope="page"]
								[@c.param name="id" value="" /]
							[/@c.url]
							window.location	= "${deleteUrl}" + id;
						}
					});
					return false;
				})
			};
			function _addDateTableRender() {
				$('#dyntable').unbind().bind('sort', function (){ _addEventListeners(); })
					.dataTable( {
						"sPaginationType": "full_numbers",
					 	"oLanguage": {
						 	"sSearch": "检索：",
				            "sLengthMenu": "每页显示 _MENU_ 条记录",
				            "sZeroRecords": "未找到数据.",
				            "sInfo": "显示 _START_-_END_ 条  【共 _TOTAL_ 条】",
				            "sInfoEmpty": "显示 0-0 条 共 0 条",
				            "sInfoFiltered": "(filtered from _MAX_ total records)",
				            "oPaginate": {
				            	"sFirst": "首页",	            	
				            	"sPrevious": "上一页",
				            	"sNext": "下一页",
				            	"sLast": "末页"
				            }
				        }
					});
				//增加新建模板按钮
				$("#dyntable_length").prepend('<a href="[@c.url value='/manage/FormArticle_create.action' scope="page"/]" class="radius3"><span>新建模型</span></a>&nbsp;&nbsp;');
			}
			return {
                config: {
                    theme: null
                },
                init: function () {
                    _addEventListeners();
                    _addDateTableRender();
                }
			}
		}());
	
		$(function(){
			base.config.url = "[@s.url value='/manage/FormArticle_list.action'][/@s.url]";
			base.config.renderTo = "#formArticle";
			base.config.theme = getTheme();
            //Initializing the form
        	base.init();		
		})
	</script>
</head>
<body id="body">
	<div class="contenttitle">
    	<h2 id="vertical" class="form"><span>自定义表单</span></h2>
    </div><!--contenttitle-->
    <div id="formArticle">
		[@demo.tableDisplayer id="FromArticleListTable" renderTo="${renderTo}" ajaxPage="true"  property="config.configItemList" pagesize=4 page="/manage/FormArticle_list.action" name="FreemarkerTable" config="/WEB-INF/component/table/template-stdtable-autopage.ftl" bundle="messageSource"]
			[@demo.column name="id" property="id" title="ID" headerClass="" columnClass="span-tiny center"/]
			[@demo.column name="name" property="name" title="名称" columnClass="span3 center"/]
			[@demo.column name="text" property="text" title="描述" columnClass="center"/]
			[@demo.column name="enabled" property="enabled" format="可用:禁用" title="启用状态" columnClass="span1 center"/]
			[@demo.column name="operate" property="id" title="操作" innerHtml="\la href='javascript:void(0);' act='edit' \g编辑\l/a\g&nbsp;|&nbsp;\la href='javascript:void(0);' act='delete' \g删除\l/a\g" headerClass="span1 batch center"/]
		[/@demo.tableDisplayer]
	</div>
	<div style="clear:both;"></div>
	<div id="delete-confirm" style="display:none" title="删除栏目">
		<p>自定义表单删除后将无法恢复.</p>
		您确认删除吗？
	</div>
</body>
</html>
